package com.seocoo.worker.friend.adapter;

import android.text.TextUtils;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.seocoo.worker.R;
import com.seocoo.worker.base.ImageLoaderEngine;
import com.seocoo.worker.friend.entity.Friend;

/**
 * version: 1.0
 */
public class FriendAdapter extends BaseQuickAdapter<Friend, BaseViewHolder> {


    public FriendAdapter() {
        super(R.layout.friend_item);
    }

    @Override
    protected void convert(BaseViewHolder helper, Friend item) {
        ImageView ivPhoto = helper.getView(R.id.iv_photo);
        if (TextUtils.isEmpty(item.getAvatar())) {
            ivPhoto.setImageResource(R.drawable.user_register);
        } else {
            new ImageLoaderEngine(item.getAvatar()).error(R.drawable.user_register).placeholder(R.drawable.user_register).into(ivPhoto);
        }
        helper.setText(R.id.tv_name, item.getRealName());
        helper.setText(R.id.tv_level, item.getLevel() + "");
        helper.setText(R.id.tv_phone, item.getPhoneNumber());
        helper.setText(R.id.tv_name, item.getRealName());
        helper.setText(R.id.tv_status, item.getTakeState());
    }

}
